package com.bawei.yangzongcai___chenmei.SlindingMenu;

import android.Manifest;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import com.amap.api.maps.WearMapView;
import com.amap.api.maps.model.MyLocationStyle;
import com.bawei.yangzongcai___chenmei.R;
import com.blankj.utilcode.util.PermissionUtils;


public class SlingMenuActivity6 extends AppCompatActivity {

    private WearMapView maops;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sling_menu6);
        initView();
        maops.onCreate(null);

        PermissionUtils.permission(Manifest.permission.ACCESS_FINE_LOCATION)
                .callback(new PermissionUtils.SimpleCallback() {
                    @Override
                    public void onGranted() {
                        MyLocationStyle myLocationStyle;
                        myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);//连续定位、且将视角移动到地图中心点，定位点依照设备方向旋转，并且会跟随设备移动。（1秒1次定位）如果不设置myLocationType，默认也会执行此种模式。
                        myLocationStyle.interval(2000); //设置连续定位模式下的定位间隔，只在连续定位模式下生效，单次定位模式下不会生效。单位为毫秒。
                        maops.getMap().setMyLocationStyle(myLocationStyle);//设置定位蓝点的Style
                        maops.getMap().setMyLocationEnabled(true);// 设置为true表示启动显示定位蓝点，false表示隐藏定位蓝点并不进行定位，默认是false。
                    }

                    @Override
                    public void onDenied() {

                    }
                })
                .request();
    }

    private void initView() {
        maops = findViewById(R.id.maops);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        maops.onDestroy();
    }

    @Override
    protected void onResume() {
        super.onResume();
        maops.onResume();
    }


    @Override
    protected void onPause() {
        super.onPause();
        maops.onPause();
    }


    @Override
    protected void onSaveInstanceState(@NonNull Bundle outState) {
        super.onSaveInstanceState(outState);
        maops.onSaveInstanceState(outState);
    }


}
